import cv2
image = cv2.imread('p.jpg')
image1 = image.copy()
cv2.imshow('input',image)
imgGray = cv2.cvtColor(image,cv2.COLOR_RGB2GRAY)

imgCanny = cv2.Canny(imgGray,70,200)
contours,hierarchy = cv2.findContours(imgCanny,cv2.RETR_EXTERNAL,cv2.CHAIN_APPROX_NONE)
x,y,w,h = cv2.boundingRect(contours[0])
cv2.rectangle(image,(x,y),(x+w,y+h),(0,0,255),3)

cv2.imshow('boundingrect',image)
(x,y),radius = cv2.minEnclosingCircle(contours[0])
center = (int(x),int(y))
redius =int(radius)
cv2.circle(image1,center,radius,(0,0,255),3)
cv2.imshow('minenclosingcircle',image1)
cv2.waitKey()
cv2.destroyAllWindows()